﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace E1_eMart
{
    public partial class WebForm3 : System.Web.UI.Page
    {
        public List<SanPham> listSanPham = new List<SanPham>();
        protected int loaiTaiKhoan = -1;
        public TaiKhoan account = new TaiKhoan(); 

        protected void Page_Load(object sender, EventArgs e)
        {
            DataClasses1DataContext edata = new DataClasses1DataContext();
            if (Session["username"] == null)
            {                
                return;
            }
            account =  ((TaiKhoan)Session["username"]);
            loaiTaiKhoan = (int)account.MaLoaiTaiKhoan;
            string tentaikhoan = account.TenTaiKhoan;
            
            var dsSanPham = from sp in edata.SanPhams
                            where sp.TaiKhoan.TenTaiKhoan == tentaikhoan
                            select sp;
            listSanPham = dsSanPham.ToList<SanPham>();
        }
    }
}